<?php 

JHTML::_('behavior.mootools');
$document = JFactory::getDocument(); 
$document->addScript("modules/mod_sj_tabs/assets/js/sj_tab.js"); 
$document->addStyleSheet("modules/mod_sj_tabs/assets/models/default/style.css");
$moduleWidth = $params->get('Width','100%');
$effecttype = $params->get('effect_type');
$lago2ModWidth = "width:100%";
$moduleId = $module->id;
if(is_numeric($moduleWidth) && $moduleWidth) $lago2ModWidth = "width:".$moduleWidth."px"; 
$moduleHeight = $params->get('Height','auto');
$modHeight = ""; 
if(is_numeric($moduleHeight) && $moduleHeight) {
$height = $moduleHeight;
$modHeight = "height:".$moduleHeight."px";
} else {
$height = 0;
} 
$position='';
$titlep='';
if($tabTilePosition=='top'){
$position .= 'wrap_top';
$titlep .= 'top';
}else if($tabTilePosition=='bottom'){
$position .= 'wrap_bottom';
$titlep .= 'bottom';
}else if($tabTilePosition=='left'){
$position .= 'wrap_left';
$titlep .= 'left';
}else if($tabTilePosition=='right'){
$position .= 'wrap_right';
$titlep .= 'right';
} 
?>
<script type="text/javascript">
var startSJTabs<?php echo $moduleId; ?> = function() {
var sjTabDefault<?php echo $module->id; ?>  = new SJTabDefault({
container:'st_tabdefault<?php echo $moduleId;?>',
height:<?php echo $height;?>,
duration:<?php echo $params->get('duration',1000); ?>,
eventType:'<?php echo $params->get('mouseType'); ?>', 
effectType:'<?php echo $effecttype; ?>'        
});       
};
window.addEvent('load',startSJTabs<?php echo $module->id; ?>);
</script>
<div style="display: none;"><a href="http://www.sjtemplates.com" title="Joomla Templates">Joomla Templates</a> and Joomla Extensions by sjtemplates.com</div>
<div class="st_tab_default_wrap" style="<?php echo $lago2ModWidth.";"; ?>">
<div class="st_default_container">
<div class="st_tabdefault <?php echo $position; ?>" id="st_tabdefault<?php echo $moduleId; ?>">
<ul class="tabs_title <?php echo $titlep; ?>">
<?php
$i=0;
foreach($arySelection as $item){
if($item){
$aryItem = explode("[]",$item);
$tabtitle = $aryItem[0]; 
?> 
<li title="<?php echo $tabtitle;?>" <?php if($i==0) echo 'class="first active"'; if($i==count($arySelection)-2) echo 'class="last"'; ?>><h3><span><?php echo $tabtitle; ?></span></h3></li>
<?php
}
$i++;
}
?>				
</ul>			

<div class="st_default_wrap2">
<?php foreach($arySelection as $item){
if($item){
$aryItem = explode("[]",$item);					
?>	 
<?php if($aryItem[1] =='module' ){?> 
<div class="st_default_content" <?php if($effecttype=='st_news2'){?> style="opacity: 0;"<?php }?>>
<div class="st_default_conten_wrap"> 
<?php 
$moduleItem = $sjTabsHelper->getModuleId($aryItem[2]);
foreach($moduleItem as $row){
$moduleItem = $sjTabsHelper->parseTabModuleById($row->id);
if($moduleItem) {  
echo JModuleHelper::renderModule ( $moduleItem ); 
}
} 
?>	
</div>			
</div>
<?php }else{ ?>
<div class="st_default_content" <?php if($effecttype=='st_news2'){?> style="opacity: 0;"<?php }?>>
<div class="st_default_conten_wrap"> 
<?php
if($aryItem[2]){ 
echo str_replace('[ztlt]', '<', str_replace('[ztgt]', '>', str_replace('[ztquote]', '\'', str_replace('[ztamp]', '&', str_replace('[ztdquote]', '"', $aryItem[2]))))); 
} 
?>	
</div>			
</div>
<?php }?>
<?php }?>
<?php }?> 							
</div>	 
</div>
</div>	
</div>